#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1e9+7;
const LL phi = 1e9+6;
LL KuaiPOW(LL a, LL k) {
    LL ret = 1;
    while (k) {
        if (k&1) {
            ret = (ret * a) % MOD;
        }
        k = (k>>1);
        a = (a*a)%MOD;
    }
    return ret;
}

int main() {
    int T;
    cin>>T;
    getchar();
    char c;
    while (T--) {
        LL cc = 0;
        while (c=getchar()) {
            if (!isdigit(c)) break;
            cc = cc*10%phi + c - '0';
        }
        cc += phi-1;
        LL res = KuaiPOW(2, cc);
        printf("%lld\n", res);
    }
    return 0;
}
